#ifndef NEWDIALOG_H
#define NEWDIALOG_H

#include <QDialog>
#include <QUdpSocket>
#include <QMessageBox>
#include <QDateTime>
#include <QHostAddress>
#include <QAbstractSocket>
#include <QTcpSocket>
#include <QFile>
#include <QFileDialog>
#include <QFileInfo>


namespace Ui {
class NewDialog;
}

class NewDialog : public QDialog
{
    Q_OBJECT

public:
    explicit NewDialog(QWidget *parent = 0);
    ~NewDialog();
    void get_recv(QUdpSocket *udpServer);//收到设备回复
    void set_tcp(QHostAddress addr);//建立tcp连接
    void addDatatoComBox(const QString &ipAddress,quint16 senderPort);//设置设备的下拉列表
    void start_transfer();//文件传输


private slots:
    void on_search_button_clicked();

    void on_connect_button_clicked();

    void on_chiose_button_clicked();
    void readSlot();
    //void updateProgress(qint64 bytes);

    void on_sendupdata_button_clicked();

private:
    Ui::NewDialog *ui;
    QUdpSocket *udpServer;
    QTcpSocket *tcpServer;
    QFile readFile;
    QString fileName;
    QTcpSocket *tcp_updata;
    QString addr_updata;

};

#endif // NEWDIALOG_H
